package com.example.demo.dao.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Component;

/**
 * @author Buer
 * @update 2021/5/2/00212:57
 */
@Mapper
@Component
public interface UserMapper {
    // @Insert("INSERT INTO comment(title,content) values (#{title},#{content})")
    // public int insertComment(User article);
    //
    // @Delete("DELETE FROM comment WHERE id=#{id}")
    // public int deleteComment(Integer id);

    /** 查询ID是否存在 */
    @Select("SELECT count(*) FROM users WHERE user_id =#{id}")
    public Integer selectIdIsNull(String id);

    /** 更新用户头像 */
    @Update("UPDATE users SET image_url =#{image} WHERE user_id =#{id}")
    public Integer updateImage(String id, String image);

    /** 查询token是否存在 */
    @Select("SELECT count(*) FROM users WHERE user_id =#{id}")
    public Integer selectTokenIsNull(String id);
}
